package com.rboat.exam.service.impl;

import java.util.List;
import com.rboat.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rboat.exam.mapper.ExamTestLibraryMapper;
import com.rboat.exam.domain.ExamTestLibrary;
import com.rboat.exam.service.IExamTestLibraryService;
import com.rboat.common.core.text.Convert;

/**
 * 题库Service业务层处理
 * 
 * @author rboat
 * @date 2019-09-02
 */
@Service
public class ExamTestLibraryServiceImpl implements IExamTestLibraryService 
{
    @Autowired
    private ExamTestLibraryMapper examTestLibraryMapper;

    /**
     * 查询题库
     * 
     * @param id 题库ID
     * @return 题库
     */
    @Override
    public ExamTestLibrary selectExamTestLibraryById(String id)
    {
        return examTestLibraryMapper.selectExamTestLibraryById(id);
    }

    /**
     * 查询题库列表
     * 
     * @param examTestLibrary 题库
     * @return 题库
     */
    @Override
    public List<ExamTestLibrary> selectExamTestLibraryList(ExamTestLibrary examTestLibrary)
    {
        return examTestLibraryMapper.selectExamTestLibraryList(examTestLibrary);
    }

    /**
     * 新增题库
     * 
     * @param examTestLibrary 题库
     * @return 结果
     */
    @Override
    public int insertExamTestLibrary(ExamTestLibrary examTestLibrary)
    {
        examTestLibrary.setCreateTime(DateUtils.getNowDate());
        return examTestLibraryMapper.insertExamTestLibrary(examTestLibrary);
    }

    /**
     * 修改题库
     * 
     * @param examTestLibrary 题库
     * @return 结果
     */
    @Override
    public int updateExamTestLibrary(ExamTestLibrary examTestLibrary)
    {
        examTestLibrary.setUpdateTime(DateUtils.getNowDate());
        return examTestLibraryMapper.updateExamTestLibrary(examTestLibrary);
    }

    /**
     * 删除题库对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteExamTestLibraryByIds(String ids)
    {
        return examTestLibraryMapper.deleteExamTestLibraryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除题库信息
     * 
     * @param id 题库ID
     * @return 结果
     */
    @Override
    public int deleteExamTestLibraryById(String id)
    {
        return examTestLibraryMapper.deleteExamTestLibraryById(id);
    }
}
